home *** CD-ROM | disk | FTP | other *** search
/ CICA 1995 August / CICA - The Ultimate Collection of Shareware for Windows (Disc 2) (August 1995).iso / disc2 / programr / atre27.exe / ATREE_27 / LFWIN / COMMDLG.H < prev    next >
C/C++ Source or Header  |  1992-08-01  |  13KB  |  320 lines

  1. /*****************************************************************************\
  2. *                                                                             *
  3. * commdlg.h -   Common dialog functions, types, and definitions               *
  4. *                                                                             *
  5. *               Version 1.0                                                   *
  6. *                                                                             *
  7. \*****************************************************************************/
  8.  
  9. #ifndef __COMMDLG_H     /* prevent multiple includes */
  10. #define __COMMDLG_H
  11.  
  12. #ifndef __WINDOWS_H
  13. #include <windows.h>    /* <windows.h> must be included */
  14. #endif  /* __WINDOWS_H */
  15.  
  16. #ifndef RC_INVOKED
  17. #pragma option -a-      /* Assume byte packing throughout */
  18. #endif /* !RC_INVOKED */
  19.  
  20. #ifdef __cplusplus
  21. extern "C" {            /* Assume C declarations for C++ */
  22. #endif  /* __cplusplus */
  23.  
  24. /* If included with the 3.0 windows.h, define compatible aliases */
  25. #if !defined(WINVER) || (WINVER < 0x030a)
  26. #define WINAPI      FAR PASCAL
  27. #define CALLBACK    FAR PASCAL
  28. #define LPCSTR      LPSTR
  29. #define UINT        WORD
  30. #define LPARAM      LONG
  31. #define WPARAM      WORD
  32. #define LRESULT     LONG
  33. #define HMODULE     HANDLE
  34. #define HINSTANCE   HANDLE
  35. #define HLOCAL      HANDLE
  36. #define HGLOBAL     HANDLE
  37. #endif  /* WIN3.0 */
  38.  
  39. typedef struct tagOFN
  40. {
  41.     DWORD   lStructSize;
  42.     HWND    hwndOwner;
  43.     HINSTANCE hInstance;
  44.     LPCSTR  lpstrFilter;
  45.     LPSTR   lpstrCustomFilter;
  46.     DWORD   nMaxCustFilter;
  47.     DWORD   nFilterIndex;
  48.     LPSTR   lpstrFile;
  49.     DWORD   nMaxFile;
  50.     LPSTR   lpstrFileTitle;
  51.     DWORD   nMaxFileTitle;
  52.     LPCSTR  lpstrInitialDir;
  53.     LPCSTR  lpstrTitle;
  54.     DWORD   Flags;
  55.     UINT    nFileOffset;
  56.     UINT    nFileExtension;
  57.     LPCSTR  lpstrDefExt;
  58.     LPARAM  lCustData;
  59.     UINT    (CALLBACK *lpfnHook)(HWND, UINT, WPARAM, LPARAM);
  60.     LPCSTR  lpTemplateName;
  61. }   OPENFILENAME;
  62. typedef OPENFILENAME FAR* LPOPENFILENAME;
  63.  
  64. BOOL    WINAPI GetOpenFileName(OPENFILENAME FAR*);
  65. BOOL    WINAPI GetSaveFileName(OPENFILENAME FAR*);
  66. int     WINAPI GetFileTitle(LPCSTR, LPSTR, UINT);
  67.  
  68. #define OFN_READONLY                 0x00000001
  69. #define OFN_OVERWRITEPROMPT          0x00000002
  70. #define OFN_HIDEREADONLY             0x00000004
  71. #define OFN_NOCHANGEDIR              0x00000008
  72. #define OFN_SHOWHELP                 0x00000010
  73. #define OFN_ENABLEHOOK               0x00000020
  74. #define OFN_ENABLETEMPLATE           0x00000040
  75. #define OFN_ENABLETEMPLATEHANDLE     0x00000080
  76. #define OFN_NOVALIDATE               0x00000100
  77. #define OFN_ALLOWMULTISELECT         0x00000200
  78. #define OFN_EXTENSIONDIFFERENT       0x00000400
  79. #define OFN_PATHMUSTEXIST            0x00000800
  80. #define OFN_FILEMUSTEXIST            0x00001000
  81. #define OFN_CREATEPROMPT             0x00002000
  82. #define OFN_SHAREAWARE               0x00004000
  83. #define OFN_NOREADONLYRETURN         0x00008000
  84. #define OFN_NOTESTFILECREATE         0x00010000
  85.  
  86. /* Return values for the registered message sent to the hook function
  87.  * when a sharing violation occurs.  OFN_SHAREFALLTHROUGH allows the
  88.  * filename to be accepted, OFN_SHARENOWARN rejects the name but puts
  89.  * up no warning (returned when the app has already put up a warning
  90.  * message), and OFN_SHAREWARN puts up the default warning message
  91.  * for sharing violations.
  92.  *
  93.  * Note:  Undefined return values map to OFN_SHAREWARN, but are
  94.  *        reserved for future use.
  95.  */
  96.  
  97. #define OFN_SHAREFALLTHROUGH     2
  98. #define OFN_SHARENOWARN          1
  99. #define OFN_SHAREWARN            0
  100.  
  101. typedef struct tagCHOOSECOLOR
  102. {
  103.     DWORD   lStructSize;
  104.     HWND    hwndOwner;
  105.     HWND    hInstance;
  106.     COLORREF rgbResult;
  107.     COLORREF FAR* lpCustColors;
  108.     DWORD   Flags;
  109.     LPARAM  lCustData;
  110.     UINT    (CALLBACK* lpfnHook)(HWND, UINT, WPARAM, LPARAM);
  111.     LPCSTR  lpTemplateName;
  112. } CHOOSECOLOR;
  113. typedef CHOOSECOLOR FAR *LPCHOOSECOLOR;
  114.  
  115. BOOL    WINAPI ChooseColor(CHOOSECOLOR FAR*);
  116.  
  117. #define CC_RGBINIT               0x00000001
  118. #define CC_FULLOPEN              0x00000002
  119. #define CC_PREVENTFULLOPEN       0x00000004
  120. #define CC_SHOWHELP              0x00000008
  121. #define CC_ENABLEHOOK            0x00000010
  122. #define CC_ENABLETEMPLATE        0x00000020
  123. #define CC_ENABLETEMPLATEHANDLE  0x00000040
  124.  
  125. typedef struct tagFINDREPLACE
  126. {
  127.     DWORD    lStructSize;            /* size of this struct 0x20 */
  128.     HWND     hwndOwner;              /* handle to owner's window */
  129.     HINSTANCE hInstance;             /* instance handle of.EXE that
  130.                                       * contains cust. dlg. template
  131.                                       */
  132.     DWORD    Flags;                  /* one or more of the FR_?? */
  133.     LPSTR    lpstrFindWhat;          /* ptr. to search string    */
  134.     LPSTR    lpstrReplaceWith;       /* ptr. to replace string   */
  135.     UINT     wFindWhatLen;           /* size of find buffer      */
  136.     UINT     wReplaceWithLen;        /* size of replace buffer   */
  137.     LPARAM   lCustData;              /* data passed to hook fn.  */
  138.     UINT    (CALLBACK* lpfnHook)(HWND, UINT, WPARAM, LPARAM);
  139.                                      /* ptr. to hook fn. or NULL */
  140.     LPCSTR   lpTemplateName;         /* custom template name     */
  141. } FINDREPLACE;
  142. typedef FINDREPLACE FAR *LPFINDREPLACE;
  143.  
  144. #define FR_DOWN                         0x00000001
  145. #define FR_WHOLEWORD                    0x00000002
  146. #define FR_MATCHCASE                    0x00000004
  147. #define FR_FINDNEXT                     0x00000008
  148. #define FR_REPLACE                      0x00000010
  149. #define FR_REPLACEALL                   0x00000020
  150. #define FR_DIALOGTERM                   0x00000040
  151. #define FR_SHOWHELP                     0x00000080
  152. #define FR_ENABLEHOOK                   0x00000100
  153. #define FR_ENABLETEMPLATE               0x00000200
  154. #define FR_NOUPDOWN                     0x00000400
  155. #define FR_NOMATCHCASE                  0x00000800
  156. #define FR_NOWHOLEWORD                  0x00001000
  157. #define FR_ENABLETEMPLATEHANDLE         0x00002000
  158. #define FR_HIDEUPDOWN                   0x00004000
  159. #define FR_HIDEMATCHCASE                0x00008000
  160. #define FR_HIDEWHOLEWORD                0x00010000
  161.  
  162. HWND    WINAPI FindText(FINDREPLACE FAR*);
  163. HWND    WINAPI ReplaceText(FINDREPLACE FAR*);
  164.  
  165. typedef struct tagCHOOSEFONT
  166. {
  167.     DWORD           lStructSize;        /* */
  168.     HWND            hwndOwner;          /* caller's window handle   */
  169.     HDC             hDC;                /* printer DC/IC or NULL    */
  170.     LOGFONT FAR*    lpLogFont;          /* ptr. to a LOGFONT struct */
  171.     int             iPointSize;         /* 10 * size in points of selected font */
  172.     DWORD           Flags;              /* enum. type flags         */
  173.     COLORREF        rgbColors;          /* returned text color      */
  174.     LPARAM          lCustData;          /* data passed to hook fn.  */
  175.     UINT (CALLBACK* lpfnHook)(HWND, UINT, WPARAM, LPARAM);
  176.                                         /* ptr. to hook function    */
  177.     LPCSTR          lpTemplateName;     /* custom template name     */
  178.     HINSTANCE       hInstance;          /* instance handle of.EXE that
  179.                                          * contains cust. dlg. template
  180.                                          */
  181.     LPSTR           lpszStyle;          /* return the style field here
  182.                                          * must be LF_FACESIZE or bigger */
  183.     UINT            nFontType;          /* same value reported to the EnumFonts
  184.                                          * call back with the extra FONTTYPE_
  185.                                          * bits added */
  186.     int             nSizeMin;           /* minimum pt size allowed & */
  187.     int             nSizeMax;           /* max pt size allowed if    */
  188.                                         /* CF_LIMITSIZE is used      */
  189. } CHOOSEFONT;
  190. typedef CHOOSEFONT FAR *LPCHOOSEFONT;
  191.  
  192. BOOL WINAPI ChooseFont(CHOOSEFONT FAR*);
  193.  
  194. #define CF_SCREENFONTS               0x00000001
  195. #define CF_PRINTERFONTS              0x00000002
  196. #define CF_BOTH                      (CF_SCREENFONTS | CF_PRINTERFONTS)
  197. #define CF_SHOWHELP                  0x00000004L
  198. #define CF_ENABLEHOOK                0x00000008L
  199. #define CF_ENABLETEMPLATE            0x00000010L
  200. #define CF_ENABLETEMPLATEHANDLE      0x00000020L
  201. #define CF_INITTOLOGFONTSTRUCT       0x00000040L
  202. #define CF_USESTYLE                  0x00000080L
  203. #define CF_EFFECTS                   0x00000100L
  204. #define CF_APPLY                     0x00000200L
  205. #define CF_ANSIONLY                  0x00000400L
  206. #define CF_NOVECTORFONTS             0x00000800L
  207. #define CF_NOOEMFONTS                CF_NOVECTORFONTS
  208. #define CF_NOSIMULATIONS             0x00001000L
  209. #define CF_LIMITSIZE                 0x00002000L
  210. #define CF_FIXEDPITCHONLY            0x00004000L
  211. #define CF_WYSIWYG                   0x00008000L /* must also have CF_SCREENFONTS & CF_PRINTERFONTS */
  212. #define CF_FORCEFONTEXIST            0x00010000L
  213. #define CF_SCALABLEONLY              0x00020000L
  214. #define CF_TTONLY                    0x00040000L
  215. #define CF_NOFACESEL                 0x00080000L
  216. #define CF_NOSTYLESEL                0x00100000L
  217. #define CF_NOSIZESEL                 0x00200000L
  218.  
  219. /* these are extra nFontType bits that are added to what is returned to the
  220.  * EnumFonts callback routine */
  221.  
  222. #define SIMULATED_FONTTYPE      0x8000
  223. #define PRINTER_FONTTYPE        0x4000
  224. #define SCREEN_FONTTYPE         0x2000
  225. #define BOLD_FONTTYPE           0x0100
  226. #define ITALIC_FONTTYPE         0x0200
  227. #define REGULAR_FONTTYPE        0x0400
  228.  
  229. #define WM_CHOOSEFONT_GETLOGFONT        (WM_USER + 1)
  230.  
  231.  
  232. /* strings used to obtain unique window message for communication
  233.  * between dialog and caller
  234.  */
  235. #define LBSELCHSTRING  "commdlg_LBSelChangedNotify"
  236. #define SHAREVISTRING  "commdlg_ShareViolation"
  237. #define FILEOKSTRING   "commdlg_FileNameOK"
  238. #define COLOROKSTRING  "commdlg_ColorOK"
  239. #define SETRGBSTRING   "commdlg_SetRGBColor"
  240. #define FINDMSGSTRING  "commdlg_FindReplace"
  241. #define HELPMSGSTRING  "commdlg_help"
  242.  
  243. /* HIWORD values for lParam of commdlg_LBSelChangeNotify message */
  244. #define CD_LBSELNOITEMS -1
  245. #define CD_LBSELCHANGE   0
  246. #define CD_LBSELSUB      1
  247. #define CD_LBSELADD      2
  248.  
  249. typedef struct tagPD
  250. {
  251.     DWORD   lStructSize;
  252.     HWND    hwndOwner;
  253.     HGLOBAL hDevMode;
  254.     HGLOBAL hDevNames;
  255.     HDC     hDC;
  256.     DWORD   Flags;
  257.     UINT    nFromPage;
  258.     UINT    nToPage;
  259.     UINT    nMinPage;
  260.     UINT    nMaxPage;
  261.     UINT    nCopies;
  262.     HINSTANCE hInstance;
  263.     LPARAM  lCustData;
  264.     UINT    (CALLBACK* lpfnPrintHook)(HWND, UINT, WPARAM, LPARAM);
  265.     UINT    (CALLBACK* lpfnSetupHook)(HWND, UINT, WPARAM, LPARAM);
  266.     LPCSTR  lpPrintTemplateName;
  267.     LPCSTR  lpSetupTemplateName;
  268.     HGLOBAL hPrintTemplate;
  269.     HGLOBAL hSetupTemplate;
  270. } PRINTDLG;
  271. typedef PRINTDLG  FAR* LPPRINTDLG;
  272.  
  273. BOOL    WINAPI PrintDlg(PRINTDLG FAR*);
  274.  
  275. #define PD_ALLPAGES                  0x00000000
  276. #define PD_SELECTION                 0x00000001
  277. #define PD_PAGENUMS                  0x00000002
  278. #define PD_NOSELECTION               0x00000004
  279. #define PD_NOPAGENUMS                0x00000008
  280. #define PD_COLLATE                   0x00000010
  281. #define PD_PRINTTOFILE               0x00000020
  282. #define PD_PRINTSETUP                0x00000040
  283. #define PD_NOWARNING                 0x00000080
  284. #define PD_RETURNDC                  0x00000100
  285. #define PD_RETURNIC                  0x00000200
  286. #define PD_RETURNDEFAULT             0x00000400
  287. #define PD_SHOWHELP                  0x00000800
  288. #define PD_ENABLEPRINTHOOK           0x00001000
  289. #define PD_ENABLESETUPHOOK           0x00002000
  290. #define PD_ENABLEPRINTTEMPLATE       0x00004000
  291. #define PD_ENABLESETUPTEMPLATE       0x00008000
  292. #define PD_ENABLEPRINTTEMPLATEHANDLE 0x00010000
  293. #define PD_ENABLESETUPTEMPLATEHANDLE 0x00020000
  294. #define PD_USEDEVMODECOPIES          0x00040000
  295. #define PD_DISABLEPRINTTOFILE        0x00080000
  296. #define PD_HIDEPRINTTOFILE           0x00100000
  297.  
  298. typedef struct tagDEVNAMES
  299. {
  300.     UINT wDriverOffset;
  301.     UINT wDeviceOffset;
  302.     UINT wOutputOffset;
  303.     UINT wDefault;
  304. } DEVNAMES;
  305. typedef DEVNAMES FAR* LPDEVNAMES;
  306.  
  307. #define DN_DEFAULTPRN      0x0001
  308.  
  309. DWORD   WINAPI CommDlgExtendedError(void);
  310.  
  311. #ifdef __cplusplus
  312. }                       /* End of extern "C" { */
  313. #endif  /* __cplusplus */
  314.  
  315. #ifndef RC_INVOKED
  316. #pragma option -a.      /* Revert to default packing */
  317. #endif  /* RC_INVOKED */
  318.  
  319. #endif  /* __COMMDLG_H */
  320.